\newcommand{\tts}[1]{\texttt{\small #1}}

\definecolor{Orange}{rgb}{1,0.5,0}
\definecolor{Gray}{rgb}{0.5,0.5,0.5}
\definecolor{LtGray}{rgb}{0.66,0.66,0.66}
\definecolor{Red}{rgb}{0.8,0,0}
\definecolor{Blue}{rgb}{0,0,0.9}
\definecolor{Green}{rgb}{0,0.33,0}

%\newcommand{\w}[1]{{#1}}

\newcommand{\brok}[1]{\sout{#1}}
\newcommand{\cbrok}[1]{\textcolor{Gray}{\brok{#1}}}
\newcommand{\less}[1]{\ensuremath{\check{#1}}}
\newcommand{\cless}[1]{\textcolor{Gray}{\less{#1}}}
\newcommand{\ok}[1]{#1}
\newcommand{\cok}[1]{\ok{#1}}

\renewcommand{\b}[1]{\cbrok{#1}}
\renewcommand{\l}[1]{\cless{#1}}
\renewcommand{\o}[1]{\cok{#1}}

\newcommand{\vhead}[1]{\begin{sideways}#1\end{sideways}}
%\newcommand{\nl}[]{\\&&&}
\newcommand{\none}{-}
\newcommand{\broken}{\ensuremath{\otimes}}
\newcommand{\lessfunc}{\ensuremath{\circleddash}}
\newcommand{\phone}{Phone \#}
\newcommand{\histbookmarks}{Bookmarks}
\newcommand{\sms}{SMS}
\newcommand{\imei}{Device ID}
\newcommand{\location}{Location}
\newcommand{\contacts}{Contacts}
\newcommand{\calendar}{Calendar}
\newcommand{\verify}[1]{\textcolor{Red}{#1}}

\newcommand{\sur}[0]{S}
\newcommand{\cov}[0]{C}
\newcommand{\ove}[0]{O}

\newcommand{\ooo}[0]{\o{\sur}\o{\cov}\o{\ove}}
\newcommand{\ool}[0]{\o{\sur}\o{\cov}\l{\ove}}
\newcommand{\oob}[0]{\o{\sur}\o{\cov}\b{\ove}}
\newcommand{\olo}[0]{\o{\sur}\l{\cov}\o{\ove}}
\newcommand{\oll}[0]{\o{\sur}\l{\cov}\l{\ove}}
\newcommand{\olb}[0]{\o{\sur}\l{\cov}\b{\ove}}
\newcommand{\obo}[0]{\o{\sur}\b{\cov}\o{\ove}}
\newcommand{\obl}[0]{\o{\sur}\b{\cov}\l{\ove}}
\newcommand{\obb}[0]{\o{\sur}\b{\cov}\b{\ove}}

\newcommand{\loo}[0]{\l{\sur}\o{\cov}\o{\ove}}
\newcommand{\lol}[0]{\l{\sur}\o{\cov}\l{\ove}}
\newcommand{\lob}[0]{\l{\sur}\o{\cov}\b{\ove}}
\newcommand{\llo}[0]{\l{\sur}\l{\cov}\o{\ove}}
%\newcommand{\lll}[0]{\l{\sur}\l{\cov}\l{\ove}} % orange?
\newcommand{\llll}[0]{\l{\sur}\l{\cov}\l{\ove}} % orange?
\newcommand{\llb}[0]{\l{\sur}\l{\cov}\b{\ove}} % orange?
\newcommand{\lbo}[0]{\l{\sur}\b{\cov}\o{\ove}}
\newcommand{\lbl}[0]{\l{\sur}\b{\cov}\l{\ove}} % orange?
\newcommand{\lbb}[0]{\l{\sur}\b{\cov}\b{\ove}} % orange?

\newcommand{\boo}[0]{\b{\sur}\o{\cov}\o{\ove}}
\newcommand{\bol}[0]{\b{\sur}\o{\cov}\l{\ove}}
\newcommand{\bob}[0]{\b{\sur}\o{\cov}\b{\ove}}
\newcommand{\blo}[0]{\b{\sur}\l{\cov}\o{\ove}}
\newcommand{\bll}[0]{\b{\sur}\l{\cov}\l{\ove}}  % orange?
\newcommand{\blb}[0]{\b{\sur}\l{\cov}\b{\ove}}  % orange?
\newcommand{\bbo}[0]{\b{\sur}\b{\cov}\o{\ove}}
\newcommand{\bbl}[0]{\b{\sur}\b{\cov}\l{\ove}}  % orange?
\newcommand{\bbb}[0]{\textcolor{red}{\brok{\sur}\brok{\cov}\brok{\ove}}}

\newcommand{\sys}{\mbox{MetaSync}\xspace}
\newcommand{\syss}{\mbox{metasync}\xspace}
\newcommand{\tomcomment}[1]{\textcolor{Blue}{[tom: #1]}}
\newcommand{\akcomment}[1]{\textcolor{Blue}{[ak: #1]}}
\newcommand{\TK}[1]{\textcolor{Blue}{[TK: #1]}}
\newcommand{\XXX}{\textcolor{Red}{XXX }}

\newcommand{\vladd}[1]{\textcolor{cyan}{#1}}
\newcommand{\vlremove}[1]{\textcolor{Gray}{\sout{#1}}}
\newcommand{\vlreplace}[2]{\textcolor{Gray}{\sout{#1}}\textcolor{cyan}{#2}}
\newcommand{\vlcomment}[1]{\textcolor{Orange}{[vl: #1]}}

\newcommand{\shadd}[1]{\textcolor{magenta}{#1}}
\newcommand{\shremove}[1]{\textcolor{Gray}{\sout{#1}}}
\newcommand{\shreplace}[2]{\textcolor{Gray}{\sout{#1}}\textcolor{magenta}{#2}}
\newcommand{\shcomment}[1]{\textcolor{Orange}{[seungyeop: #1]}}
\newcommand{\hscomment}[1]{\textcolor{Green}{[haichen: #1]}}

% To show changes in the document, comment out the \renewcommand definitions below
%\renewcommand{\vladd}[1]{#1}
%\renewcommand{\vlremove}[1]{}
%\renewcommand{\vlreplace}[2]{#2}
%\renewcommand{\vlcomment}[1]{}

%\renewcommand{\shadd}[1]{#1}
%\renewcommand{\shremove}[1]{}
%\renewcommand{\shreplace}[2]{#2}
%\renewcommand{\shcomment}[1]{}
%\renewcommand{\TK}[1]{}

%\renewcommand{\aladd}[1]{#1}
%\renewcommand{\alremove}[1]{}
%\renewcommand{\alreplace}[2]{#2}
%\renewcommand{\alcomment}[1]{}

% autoref
\def\Snospace~{\S{}}
\renewcommand*\sectionautorefname{\Snospace}
\def\sectionautorefname{\Snospace}
\def\subsectionautorefname{\Snospace}
\def\subsubsectionautorefname{\Snospace}
\def\chapterautorefname{\Snospace}
\def\algorithmautorefname{Algorithm}

% various lists
\newcommand{\squishlist}{
   \begin{list}{$\bullet$}
    { \setlength{\itemsep}{0pt}      \setlength{\parsep}{0pt}
      \setlength{\topsep}{3pt}       \setlength{\partopsep}{0pt}
      \setlength{\leftmargin}{1em} \setlength{\labelwidth}{1em}
      \setlength{\labelsep}{0.5em} } }

\newcommand{\squishlistcirc}{
   \begin{list}{$\circ$}
    { \setlength{\itemsep}{0pt}      \setlength{\parsep}{3pt}
      \setlength{\topsep}{3pt}       \setlength{\partopsep}{0pt}
      \setlength{\leftmargin}{1.5em} \setlength{\labelwidth}{1em}
      \setlength{\labelsep}{0.5em} } }

\newcommand{\squishlisttwo}{
   \begin{list}{$\bullet$}
    { \setlength{\itemsep}{0pt}    \setlength{\parsep}{0pt}
      \setlength{\topsep}{0pt}     \setlength{\partopsep}{0pt}
      \setlength{\leftmargin}{2em} \setlength{\labelwidth}{1.5em}
      \setlength{\labelsep}{0.5em} } }

\newcommand{\squishend}{
    \end{list} \vspace{5pt} }
%\ifpdf
%\setlength{\pdfpagewidth}{8.5in}
%\setlength{\pdfpageheight}{11in}
%\else
%\fi

\newcommand{\includepdf}[1]{
  \includegraphics[width=\columnwidth]{#1}
}
\newcommand{\includeplot}[1]{
  \resizebox{\columnwidth}{!}{\input{#1}}
}

% use \cc instead of \texttt
\newcommand{\cc}[1]{\mbox{\smaller[0.5]\texttt{#1}}}
\newcommand{\cC}[1]{\mbox{\texttt{#1}}}

% define math operator argmax, argmin
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

% common rules
\newcommand{\figrule}{\hrule width \hsize height .33pt \vspace{5px}}
\newcommand{\coderule}{\vspace{-0.4em}\figrule}

% algo
\algnewcommand{\algorithmicgoto}{\textbf{go to}}%
\algnewcommand{\Goto}{\algorithmicgoto\xspace}%
\algnewcommand{\Label}[1]{\Statex\unskip \texttt{\bf \ \ #1:}}
\algnewcommand\algorithmicswitch{\textbf{switch}}
\algnewcommand\algorithmiccase{\textbf{case}}
\algnewcommand\algorithmicassert{\texttt{assert}}
\algnewcommand\Assert[1]{\State \algorithmicassert(#1)}%

\algdef{SE}[SWITCH]{Switch}{EndSwitch}[1]{\algorithmicswitch\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicswitch}%
\algdef{SE}[CASE]{Case}{EndCase}[1]{\algorithmiccase\ #1}{\algorithmicend\ \algorithmiccase}%
\algtext*{EndSwitch}%
\algtext*{EndCase}%